<?php
namespace app\index\controller;

use think\Session;
class Recruit  extends Common
{
    //招聘展示
    public function index()
    {
        //logo
        $logo=db('logo')->where('caro_states',1)->column('logo_img');
        $this->assign('logo',$logo[0]);
        //轮播图
        $imgdata=db('carousel')->where('caro_states',1)->field('caro_img')->select();
        //halt($imgdata);
        $this->assign('imgdata',$imgdata);
        //分类导航
        $typedata=db('types')->where('type_pid',1)->select();
        foreach($typedata as $k=>$v)
        {
            $v['typeson']=db('types')->where('type_pid',$v['type_id'])->select();
            $typedata[$k]=$v;
        }
        //halt($typedata);
        $this->assign('typedata',$typedata);

        //找聘信息
        //关于我们的信息
        $id=input('param.type_pid');
        $type=db('types')->where('type_id',$id)->find();
        $typeson=db('types')->where('type_pid',$type['type_id'])->select();

        $newdata=db('contents')->where('cont_pid',$id)->order('cont_id desc')->paginate(10);
        $count=db('contents')->where('cont_pid',$id)->order('cont_id desc')->count('cont_id');
        //halt($newdata);
         //halt($typeson);
        $this->assign('count',$count);
        $this->assign('newdata',$newdata);
        $this->assign('type',$type);
        $this->assign('typeson',$typeson);



        return $this->fetch();
    }
    public function info()
    {
    	  //logo
        $logo=db('logo')->where('caro_states',1)->column('logo_img');
        $this->assign('logo',$logo[0]);
        //轮播图
        $imgdata=db('carousel')->where('caro_states',1)->field('caro_img')->select();
        //halt($imgdata);
        $this->assign('imgdata',$imgdata);
        //分类导航
        $typedata=db('types')->where('type_pid',1)->select();
        foreach($typedata as $k=>$v)
        {
            $v['typeson']=db('types')->where('type_pid',$v['type_id'])->select();
            $typedata[$k]=$v;
        }
        //halt($typedata);
        $this->assign('typedata',$typedata);


         $id=input('param.id');
         $type_id=input('param.type_id');
         $newdata=db('contents')->where('cont_id',$id)->find();
        $typefind=db('types')->where('type_id',$type_id)->find();
   
        //halt($typeson);
        
        $this->assign('typefind',$typefind);
         $this->assign('newdata',$newdata);
         return $this->fetch();
    }
   
}